package gwtappcontainer.server.apps.videos;

import gwtappcontainer.shared.apis.videos.VideoProp;

import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;


@Entity
public class VideoEntity {
	@Id public Long id;
	
	public String tag;
	public String titleHtml;
	public String descriptionHtml;
	public String videoFrameHtml;
	public String appealHtml;
	public boolean enabled;
	public String msgWhenVideoNotAvailableHtml;
	
	public VideoEntity() {}
		
	public VideoProp getVideoProp() {
		VideoProp prop = new VideoProp();
		
		prop.tag = tag;
		prop.titleHtml = titleHtml;
		prop.descriptionHtml = descriptionHtml;
		prop.videoFrameHtml = videoFrameHtml;
		prop.appealHtml = appealHtml;
		prop.enabled = enabled;
		prop.msgWhenVideoNotAvailableHtml = msgWhenVideoNotAvailableHtml;
		
		
		return prop;
	}
	
	public void populateFromVideoProp(VideoProp prop) {
		tag = prop.tag;
		titleHtml = prop.titleHtml;
		descriptionHtml = prop.descriptionHtml;		
		videoFrameHtml = prop.videoFrameHtml;	
		appealHtml = prop.appealHtml;
		enabled = prop.enabled;
		msgWhenVideoNotAvailableHtml = prop.msgWhenVideoNotAvailableHtml;	
	}
	
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("class = [" + VideoEntity.class.getName() + "], ");
		sb.append("id = [" + id + "], ");
		sb.append("tag = [" + tag + "], ");
		sb.append("titleHtml = [" + titleHtml + "], ");
		sb.append("descriptionHtml = [" + descriptionHtml + "], ");
		sb.append("videoFrameHtml = [" + videoFrameHtml + "], ");
		sb.append("appealHtml = [" + appealHtml + "], ");
		sb.append("enabled = [" + enabled + "], ");
		sb.append("msgWhenVideoNotAvailableHtml = [" + msgWhenVideoNotAvailableHtml + "]");
		
		return sb.toString();
	}
}
